﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PRJ_LDW_Eutoliso.AccountAdmin.Endereco.Cidade
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                using (eutolisodbEntities1 context = new eutolisodbEntities1())
                {

                    cidade c = new cidade();
                    
                    context.cidade.Attach(c);
                    // Now context should believe that it has Student with single Course loaded from the database
                    // So remove that link to existing course but don't delete the course       
                    context.cidade.Remove(c);
                    context.SaveChanges();
                }

            }
            catch (Exception)
            {
                
                //throw;
            }
        }
    }
}